#ifndef COLORMARKER_H
#define COLORMARKER_H

#include "opencv2/opencv.hpp"
#include "xcorner/XCornerFinder.h"

#ifndef MAX_XCORNERS
#define MAX_XCORNERS 2000
#endif

#define HBINS 30
#define SBINS 32



using namespace std;
using namespace cv;

class ColorMarker;

class ColorMarkerDetector
{
public:
    enum HueValue
    {
        RED    = 0,
        YELLOW = 60,
        GREEN  = 120,
        L_BLUE = 180,
        D_BLUE = 240,
        PINK   = 300
    };
    ColorMarkerDetector( int width, int height );
    ~ColorMarkerDetector();
    void detect( Mat &input, vector<ColorMarker> &list, int outer );
    static Scalar RGB2HSV( int R, int G, int B );
    static Scalar RGB2HSV( Scalar c );
private:
    int w, h;
    IplImage * cvImg32;
    CvPoint2D32f * xc_points;
    CXCornerFinder * xc_finder;
};

class ColorMarker : public Point2f
{
public:
    ColorMarker( double x, double y, int hue );
    int hue;
    SparseMat hist;
    double compareEMD( ColorMarker );
};

#endif // COLORMARKER_H
